package structural.proxy;

public class EbookProxy implements IEbook {
    private final String fileName;
    private RealEbook realEbook;

    public EbookProxy(String fileName) {
        this.fileName = fileName;
        this.realEbook = null; // RealEbook will be created on demand
    }

    @Override
    public void show() {
        if (realEbook == null) {
            realEbook = new RealEbook(fileName);  // Lazy loading of RealEbook
        }
        realEbook.show();
    }

    @Override
    public String fileName() {
        return fileName;
    }
}
